package com.chixing.ih.module.programmer.service.Impl;

import com.chixing.ih.module.programmer.mapper.WorkMapper;
import com.chixing.ih.module.programmer.pojo.Work;
import com.chixing.ih.module.programmer.service.IWorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘岩
 * Date: 2020-09-26
 * Time: 16:23
 *
 * @version 1.0
 */
@Service
@Transactional
public class WorkServiceImpl implements IWorkService {

    @Autowired
    WorkMapper workMapper;


    @Override
    public Work getWork(long programmerId) {
        Work work = workMapper.getOne(programmerId);
        return work;
    }

    @Override
    public boolean saveWork(Work work) {
        int record = workMapper.updateOne(work);
        if (record > 0)
            return true;
        else
            return false;
    }

    @Override
    public boolean saveUserId(long userId) {
        int record = workMapper.insertWork(userId);
        if (record > 0)
            return true;
        else
            return false;
    }
}
